package com.fitsoftwareprocess.mobimap.dto;

public class GraphNodeInfo extends NodeInfo{
	private double _length;
    private Boolean _isRoot = false;
    private int _graphCost = 0;
    private int _heuristic = 0;
    private int _function = 0;
    private GraphNodeInfo _parent = null;
    
    public GraphNodeInfo()
    {
    }
    public GraphNodeInfo(GraphNodeInfo node)
    {
        this.set_heuristic(node.get_heuristic());
        this.set_function(node.get_function());
        this.set_graphCost(node.get_graphCost());
        this.set_id(node.get_id());
        this.set_isRoot(node.get_isRoot());
        this.set_length(node.get_length());
        this.set_location(node.get_location());
        this.set_parent(node.get_parent());
            
    }

    public void PathScoring()
    {
        _function = _graphCost + _heuristic;
    }

    public void MovementCost()
    {
        //GraphNodeInfo node = new GraphNodeInfo();
        //node.Parent = parent;
        //node.length = length;
        //while (!node.isRoot)
        //{
        //    graphCost += node.Length;
        //    node = node.Parent;
        //    if (node == null)
        //        return;
        //}
        _graphCost = _heuristic;
    }

    public Boolean Equals(Object obj)
    {
        GraphNodeInfo node = (GraphNodeInfo)obj;
        if (node.get_id() == _id)
            return true;
        return false;
    }
    
    //#region IComparable<GraphNodeInfo> Members
    public int CompareTo(GraphNodeInfo other)
    {
        if (other.get_function() == this.get_function())
            return 0;
        if (other.get_function() < this.get_function())
            return 1;
        return -1;
    }
    //#endregion
	public double get_length() {
		return _length;
	}
	public void set_length(double d) {
		this._length = d;
	}
	public Boolean get_isRoot() {
		return _isRoot;
	}
	public void set_isRoot(Boolean _isRoot) {
		this._isRoot = _isRoot;
	}
	public int get_graphCost() {
		return _graphCost;
	}
	public void set_graphCost(int _graphCost) {
		this._graphCost = _graphCost;
	}
	public int get_heuristic() {
		return _heuristic;
	}
	public void set_heuristic(int _heuristic) {
		this._heuristic = _heuristic;
	}
	public int get_function() {
		return _function;
	}
	public void set_function(int _function) {
		this._function = _function;
	}
	public GraphNodeInfo get_parent() {
		return _parent;
	}
	public void set_parent(GraphNodeInfo _parent) {
		this._parent = _parent;
	}
}
